﻿using System;
using System.ComponentModel;


namespace advadev.Windows.Graph.Demo
{

    /// <summary>
    /// Represents the main view model
    /// </summary>
    public class MainViewModel : INotifyPropertyChanged
    {

        /// <summary>for internal use</summary>
        static private MainViewModel _current = new MainViewModel();


        /// <summary>
        /// Initializes a new instance of the MainViewModel class
        /// </summary>
        private MainViewModel()
        {
        }


        /// <summary>
        /// Gets the current main view model
        /// </summary>
        static public MainViewModel Current
        {
            get
            {
                return _current;
            }
        }


        #region INotifyPropertyChanged implementation
        /// <summary>for internal use</summary>
        private event PropertyChangedEventHandler _propertyChanged;

        /// <summary>
        /// Handles the "property changed" event
        /// </summary>
        /// <param name="propertyName">
        /// Name of the changed property
        /// </param>
        protected void OnPropertyChanged(string propertyName)
        {
            if (_propertyChanged != null)
            {
                _propertyChanged(this, new PropertyChangedEventArgs(propertyName));
            }
        }

        /// <summary>
        /// Occurs when a property value changes
        /// </summary>
        public event PropertyChangedEventHandler PropertyChanged
        {
            add
            {
                _propertyChanged += value;
            }
            remove
            {
                _propertyChanged -= value;
            }
        }
        #endregion INotifyPropertyChanged implementation

    }

}
